package com.hmdp;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * @program: hm-dianping
 * @description:
 * @author: Feng
 * @create: 2023-03-18 10:59
 **/

@SpringBootTest
public class UVCount {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Test
    void Test01() {
        String[] view = new String[1000];
        for (int i = 0; i < 1000000; i++) {
            int j = i%1000;
            view[j]="user_"+i;
            if(j==999){
                stringRedisTemplate.opsForHyperLogLog().add("uv",view);
            }
        }
        System.out.println(stringRedisTemplate.opsForHyperLogLog().size("uv"));


    }
}
